import Components from 'unplugin-vue-components/vite'
import IconsResolver from 'unplugin-icons/resolver'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'

export default function createComponents() {
    return Components({
        include: [
            /\.[tj]sx?$/,
            /\.vue$/,
            /\.vue\?vue/,
        ],
        extensions: ['vue', 'jsx', 'tsx', 'ts', 'js'],
        resolvers: [
            // 自动注册图标组件
            IconsResolver({
                enabledCollections: ['ep'] //@iconify-json/ep 是 Element Plus 的图标库
            }),
            // 自动导入 Element Plus 组件
            ElementPlusResolver()
        ],
    })
}
